#ifndef _bsp_brush_def_chris_sep_14_header_guard_
#define _bsp_brush_def_chris_sep_14_header_guard_

#include "config.h"
#include <Eigen/StdVector>
#include <Eigen/Core>
#include "Polygon3D.h"
#include <boost/shared_ptr.hpp>

namespace libPortal
{
  class PORTALAPI BSPPlane 
  {
  public:
    BSPPlane(Eigen::Hyperplane<double, 3> planeEq);
    virtual ~BSPPlane() {}
    std::string textureFileName;
    Polygon3D planeShape;
    std::vector<Eigen::Vector2d> texCoords;
  };

  class PORTALAPI BSPBrush3D
  {
  public:
    virtual ~BSPBrush3D() {}
    std::vector<boost::shared_ptr<BSPPlane> > planes;
  };

  /**
     This function returns information about the brush b, on wether
     it is a rectangle or not. If it is not a rectangle then 
     transform is not changed. If it is a rectangle then transform 
     is set to the column major (OpenGL) matrix that represents the 
     transformation needed to take a 1x1x1 axis aligned cube at the
     origin onto the brush b.
     @param b the brush to return information about
     @param transform the matrix that holds the transformation
     @return true if b is a rectange and transform was changed.
   */
  extern "C" PORTALAPI bool isRectangular(const BSPBrush3D &b, 
					  Eigen::Transform<double, 3> &transform);
}

#endif
